#ifndef TABLEMODEL_H
#define TABLEMODEL_H

#include <QAbstractTableModel>

typedef struct FileRecord {
    bool bChecked;//是否选中
    QString strFilePath;//文件路径
}fileRecord;

class TableModel : public QAbstractTableModel
{
public:
    TableModel(QObject *parent = NULL);
    ~TableModel();

public:
    void updateData(QList<FileRecord> recordList);// 更新表格数据
    virtual int  rowCount(const QModelIndex &parent) const;// 行数
    virtual int columnCount(const QModelIndex &parent) const;// 列数
    bool setData(const QModelIndex &index, const QVariant &value, int role);// 设置表格项数据
    QVariant data(const QModelIndex &index, int role) const;// 表格项数据
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;// 表头数据
    Qt::ItemFlags flags(const QModelIndex &index) const;// 表格可选中、可复选

private:
    QList<FileRecord> m_recordList;
};

#endif // TABLEMODEL_H
